<template>
  <div class="app-container">
    <!--内部头部-->
    <inner-header :query.sync="queryParams" :ids="ids" @confirm="getList"></inner-header>
    <!--内部表格-->
    <inner-table :data="tableData" v-model:ids="ids" :loading="loading" @success="getList"></inner-table>
    <!--分页组件-->
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <!--内部弹窗-->
    <inner-dialog ref="$" @success="getList"></inner-dialog>
  </div>
</template>
<script setup name="Notice">
import { createOne, updateOne, deleteOne, queryOne, queryList } from "../../api/notice";
import InnerTable from "./components/InnerTable.vue";
import InnerHeader from "./components/InnerHeader.vue";
import InnerDialog from "./components/InnerDialog.vue";

import { onMounted, provide } from "vue";
const tableData = ref([]);
const loading = ref(false);
const total = ref(0);
const ids = ref([]);
const $ = ref(null);
// 这个属性根据不同需要修改
const queryParams = ref({
  pageSize: 10,
  pageNum: 1,
  title: "",
  type: "",
});

// 查询列表
function getList() {
  loading.value = true;
  queryList(queryParams.value).then((res) => {
    tableData.value = res.content;
    total.value = res.totalElements;
    loading.value = false;
  });
}

onMounted(() => {
  getList();
});
// 方法数据 expose
provide("$", $);
provide("createOne", createOne);
provide("updateOne", updateOne);
provide("queryOne", queryOne);
provide("deleteOne", deleteOne);
</script>
<!--样式集成-->
<style scoped></style>
